-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expose preventEviction as unsafePreventEviction for Durable Objects #726
Conversation
for durable object bindings
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to see a test here that:
- Didn't set this flag, waited for 10 seconds, and verified that the DO was evicted
- Did set this flag, waited for 10 seconds, and verified that the DO wasn't evicted
packages/miniflare/src/index.ts
Outdated
if (existingInfo?.unsafeUniqueKey !== unsafeUniqueKey) { | ||
throw new MiniflareCoreError( | ||
"ERR_DIFFERENT_UNIQUE_KEYS", | ||
`Multiple unsafe unique keys defined for Durable Object "${className}" in "${serviceName}": ${JSON.stringify( | ||
unsafeUniqueKey | ||
)} and ${JSON.stringify(existingUnsafeUniqueKey)}` | ||
)} and ${JSON.stringify(existingInfo?.unsafeUniqueKey)}` | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a similar check for unsafePreventEviction
? Since a Durable Object can have multiple bindings to it, and this configuration is defined at the binding level, but set in workerd
with each Durable Object, we need to make sure unsafePreventEviction
is configured the same on all bindings to the same Durable Object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. Do you want a test for this behaviour? Can't see one for existingUnsafeUniqueKey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not too worried about it, but if you're offering... 😃
across all bindings to each durable object
Going to merge this now. I'm about to start the migration to |
No description provided.